﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using COM.Rights.Model;
using COM.Rights.BLL;

public partial class Pages_TRole_Edit : ZMPageEdit<TRole, TRoleInfo>
{
    #region 重写方法

    protected override void OnBinded()
    {
        base.OnBinded();
        checkedIDs.Value = InitFunctionIDs();
    }


    public string InitFunctionIDs()
    {
        string ids = "";

        foreach (TRoleTTTFunctionInfo info in new TRoleTTTFunction().GetFunctionByRole(Id))
        {
            ids += info.TFunction_GID + ",";
        }
        ids.Trim(',');

        return ids;
    }


    protected override void OnAchieving()
    {
        base.OnAchieving();
        if (IsNewModel)
        {
            Model.CreatTime = DateTime.Now;
            Model.Creator = ZSession.ManagerUID;
        }
    }

    protected override void OnSave()
    {
        base.OnSave();
        string ids = checkedIDs.Value.Trim(',');

        TRoleTTTFunction bll = new TRoleTTTFunction();
        bll.SaveFunctions(Model.GID, ids);      
    }

    #endregion 	重写方法
}